<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;

class SendReminderEmail extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(Mailer $mailer)
    {
        $name = 'hello world !!! ';
        $mailer->send('mail',['name'=>$name],function($message){
            $to = '1014404765@qq.com';
//            $to = 'lipeng9@100tal.com';
            $message ->to($to)->subject('测试邮件');
            $attachment = './favicon.ico';
            //在邮件中上传附件
            $message->attach($attachment);
        });
    }
}
